// 如果没有通过拦截器配置域名的话，可以在这里写上完整的URL(加上域名部分)
let hotSearchUrl = '/s';
let indexUrl = '/ebapi/public_api/index';
let wxLoginUrl = "v3/member/login" //微信授权登录
let wxMobileLoginUrl = "v3/member/mobilelogin" //微信授权手机号登录
let addressListUrl = "v3/address/list" // 地址列表
let setAddressUrl = "v3/address/set" //新增地址
let editAddressUrl = "v3/address/update" //修改地址
let delAddressUrl = "v3/address/delete" //删除地址
let getFriendUrl = "v3/invitation/list" //获取好友列表
let get_category_url = "v3/goods/category" //获取分类
let get_goods_type_url = "v3/goods/list" //获取的商品类别
let get_shareinfo_url = "v3/invitation/getshare" //获取分享信息
let get_member_info_url = "v3/member/info" //获取用户信息
let get_collages_url = "v3/collages/collages" //获取正在开的团
let get_farmer_apply_url ="v3/farmer/apply" //升级成为农场主
let get_renew_farmer_url = "v3/farmer/renew" //续约农场主
let get_collages_detail_url = "v3/collages/detail" //获取产品信息
let get_chicken_list_url = "v3/chicken/feeding" //获取农场鸡列表 
let get_chicken_progress_url = "v3/chicken/progress" //获取蛋鸡进度 
let post_charge_url = "v3/chicken/receive" //收取鸡蛋 
let post_collages_partake_url = "v3/collages/partake" //参与拼团 
let get_order_url = "v3/order/list" //获取订单列表
let get_order_detail_url = "v3/order/detail" //获取订单详情
let get_bean_surplus_url = "v3/bean/surplus" //获取用户当前欢嘻豆
let get_nickname_url = "v3/bean/nickname" //GET /bean/nickname通过手机号获取用户昵称
let get_assignment_url = "v3/bean/assignment" //GET /bean/nickname通过手机号获取用户昵称
let get_distributioncentre_url = "v3/chicken/distributioncentre" //获取配送中心的鸡
let get_account_bill_url = "v3/account/bill" //获取配送中心的鸡
let revive_chicken_url = "v3/chicken/revive"  //复活小鸡
let distribute_url = "v3/chicken/distribute" // 配送小鸡
let feedrecord_url = "v3/chicken/feedrecord" // 饲料记录
let revivenum_url = "v3/chicken/revivenum" // 获取可复活的小鸡数
let luckynumber_url = "v3/order/luckynumber" // 获取可复活的小鸡数
let goods_list_url = "v3/goods/list" // 获取开团产品列表
let opening_collages_url = "v3/collages/opening" // 获取开团产品列表
let chickentype_url = "v3/chicken/chickentype" // 获取配送中心鸡的分类
// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 此处没有使用传入的params参数
	// let getSearch = (params = {}) => vm.$u.get(hotSearchUrl, {
	// 	id: 2
	// });
	let getSearch = (params = {}) => vm.$u.get(hotSearchUrl, params);
	// 此处使用了传入的params参数，一切自定义即可
	let getInfo = (params = {}) => vm.$u.post(indexUrl, params);

	// 微信授权登录
	let wxLogin = (params = {}) => vm.$u.post(wxLoginUrl, params);
	
	// 微信授权手机号登录
	let wxMobileLogin = (params = {}) => vm.$u.post(wxMobileLoginUrl, params);
	
	// 获取用户信息
	let getMemberInfo = (params = {}) => vm.$u.get(get_member_info_url, params);
	
	// 添加新地址
	let setAddress = (params = {}) => vm.$u.post(setAddressUrl, params);

	// 获取地址
	let getAddress = (params = {}) => vm.$u.get(addressListUrl, params);
	
	// 修改地址
	let editAddress = (params = {}) => vm.$u.post(editAddressUrl,params);
	
	// 删除地址
	let delAddress = (params = {}) => vm.$u.delete(delAddressUrl,params);
	
	//获取好友列v表数据
	let getFriend = (params = {}) => vm.$u.get(getFriendUrl, params);
	
	// 获取产品分类列表
	let getCategory =  (params = {}) => vm.$u.get(get_category_url, params);
	
	// 获取分享内容 
	let getShareInfo = (params = {}) => vm.$u.get(get_shareinfo_url, params);
	
	// 获取拼团列表
	let getCollages = (params = {}) => vm.$u.get(get_collages_url, params);
	
	// 申请成为农场主
	let getApplyFarmer = (params = {}) => vm.$u.get(get_farmer_apply_url, params);
	
	// 续约农场主
	let getRenewFarmer = (params = {}) => vm.$u.get(get_renew_farmer_url, params);
	
	// 获取产品信息 
	let getCollagesDetail = (params = {}) => vm.$u.get(get_collages_detail_url, params);
	
	// 获取农场鸡列表
	let getChickenList = (params = {}) => vm.$u.get(get_chicken_list_url, params);
	
	// 获取蛋鸡进度
	let getLayingHenProgress = (params = {}) => vm.$u.get(get_chicken_progress_url, params);
	
	// 收取鸡蛋
	let postCharge = (params = {}) => vm.$u.get(post_charge_url, params);
	
	// 参与拼团
	let postCollagesPartake = (params = {}) => vm.$u.get(post_collages_partake_url, params);
	// 获取订单列表
	let getOrder = (params = {}) => vm.$u.get(get_order_url, params);
	let getOrderDetail = (params = {}) => vm.$u.get(get_order_detail_url, params);
	// 获取当前用户欢嘻豆
	let getBeanSurplus = (params = {}) => vm.$u.get(get_bean_surplus_url, params);
	// 获取转让用户是否存在
	let getNickName = (params = {}) => vm.$u.get(get_nickname_url, params);
	// 转让欢喜豆
	let getAssignment = (params = {}) => vm.$u.get(get_assignment_url, params);
	// 获取配送中心的鸡
	let getDistributioncentre = (params = {}) => vm.$u.get(get_distributioncentre_url, params);
	// 获取账单
	let getBill = (params = {}) => vm.$u.get(get_account_bill_url, params);
	// 复活小鸡
	let reviveChicken =(params = {}) => vm.$u.post(revive_chicken_url, params);
	// 配送小鸡
	let distributeChicken =(params = {}) => vm.$u.post(distribute_url, params);
	// 饲料记录
	let chickenFeedrecord =(params = {}) => vm.$u.get(feedrecord_url, params);
	// 获取可复活的小鸡数
	let getReviveNum =(params = {}) => vm.$u.get(revivenum_url, params);
	// 获取幸运数字
	let getLuckyNumber =(params = {}) => vm.$u.get(luckynumber_url, params);
	// 获取幸运数字
	let getGoodsList =(params = {}) => vm.$u.get(goods_list_url, params);
	// 开团
	let sendCollages =(params = {}) => vm.$u.post(opening_collages_url, params);
	// 获取配送中心鸡的分类
	let getDeliveryType =(params = {}) => vm.$u.get(chickentype_url, params);
	// 获取的商品类别
	let getGoodsType =(params = {}) => vm.$u.get(get_goods_type_url, params);
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {
		getSearch,
		getInfo,
		wxLogin,
		wxMobileLogin,
		getAddress,
		setAddress,
		editAddress,
		delAddress,
		getFriend,
		getCategory,
		getShareInfo,
		getMemberInfo,
		getCollages,
		getApplyFarmer,
		getRenewFarmer,
		getCollagesDetail,
		getChickenList,
		getLayingHenProgress,
		postCharge,
		postCollagesPartake,
		getOrder,
		getOrderDetail,
		getBeanSurplus,
		getNickName,
		getAssignment,
		getDistributioncentre,
		getBill,
		reviveChicken,
		distributeChicken,
		chickenFeedrecord,
		getReviveNum,
		getLuckyNumber,
		getGoodsList,
		sendCollages,
		getDeliveryType,
		getGoodsType
	};
}

export default {
	install
}
